// https://blog.51cto.com/search/result?q=vue-router%E4%B9%8B%E8%B7%AF%E7%94%B1%E5%B1%9E%E6%80%A7%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E&type=
// https://blog.51cto.com/4547985/2390762

/**
 * routes
 */
const ROUTES_OLD =  [
	/*{
		path: string,	// 路由路径
		component?: Component,	// 组件
		name?: string, // 命名路由
		components?: { [name: string]: Component }, // 命名视图组件
		redirect?: string | Location | Function,
		props?: boolean | Object | Function,
		alias?: string | Array<string>,
		children?: Array<RouteConfig>, // 嵌套路由
		beforeEnter?: (to: Route, from: Route, next: Function) => void,
		meta?: any,
	  
		// 2.6.0+
		caseSensitive?: boolean, // 匹配规则是否大小写敏感？(默认值：false)
		pathToRegexpOptions?: Object // 编译正则的选项

	},*/
	{
		path: '/',
		redirect: to => {
			return {
				name: 'home',
			}
		}
	},
	{
		path: '/login',		
		name: 'login',
		component: () => import('@/pages/views/login'),	// 路劲渲染的页面组件，懒加载模式、异步组件
	},
	{
		path: '/io',		
		name: 'io',
		component: () => import('@/pages/views/server/io'),	// 路劲渲染的页面组件，懒加载模式、异步组件
	},
	{
		path: '/user/:id',			// 动态路由
		alias: '/account/:id',	// 别名
		component: () => import('@/pages/layout/main'), 
		children: [							
			{
				path: 'account',
				name: 'account',	// 命名路由
				alias: 'user',		// 嵌套路由	
				components: {			// 命名视图
					default: () => import('@/pages/views/user'),										// 懒加载方案一
					// defaults: () => require(['@/pages/common/user'], resolve),		// 懒加载方案二
					// helper: import('@/pages/common/helper'),
				},
				meta: {
					requiresAuth: true
				}
			} 
		]			
	},
	{
		path: '/main',																				
		component: () => import('@/pages/layout/main'), 			
		children: [ 																	// 嵌套子路由，相当于嵌入iframe
			{
				path: '/main',
				name: 'home',
				component: () => {
					// return import('@/pages/views/home');
					return import('@/pages/views/server/img');
				},
				// component: (resolve) => require(['@/pages/common/home'], resolve),
				meta: {
					requiresAuth: true,	// 是否登录
					keepAlive: false,		// 是否缓存
				}
			},
			{
				path: '/vue',
				name: 'vue',
				component: () => import('@/pages/views/vue/vue'),
				meta:{
					name: 'vue',
					requiresAuth: true
				}
			},
			{
				path: '/vue-router',
				name: 'vue-router',
				component: () => import('@/pages/views/vue/vue-router'),
				meta:{
					name: 'vue-router',
					requiresAuth: true,
					desc: '动态路由'
				}
			},
			{
				path: '/vuex',
				name: 'vuex',
				component: () => import('@/pages/views/vue/vuex'),
				meta:{
					name: 'vuex',
					requiresAuth: true
				}
			},
			{
				path: '/vue-cli',
				name: 'vue-cli',
				component: () => import('@/pages/views/vue/vue-cli'),
				meta:{
					name: 'vue-cli',
					requiresAuth: true
				}
			},
			{
				path: '/axios',
				name: 'axios',
				component: () => import('@/pages/views/vue/axios'),
				meta:{
					name: 'axios',
					requiresAuth: true
				}
			},
			{
				path: '/component',
				name: 'component',
				component: () => import('@/pages/views/vue/component/index'),
				meta:{
					name: 'component',
					requiresAuth: true
				}
			},
			{
				path: '/async',
				name: 'async',
				component: () => import('@/pages/views/vue/async'),
				meta:{
					name: 'async',
					requiresAuth: true
				}
			},
			{
				path: '/performance',
				name: 'performance',
				component: () => import('@/pages/views/vue/vue-lazyload'),
				meta:{
					name: 'performance',
					requiresAuth: true
				}
			},
			// {
			// 	path: '/code-editor',
			// 	name: 'code-editor',
			// 	component: () => import('@/pages/views/vue/code-editor'),
			// 	meta:{
			// 		name: 'code-editor',
			// 		requiresAuth: true
			// 	}
			// },
			{
				path: '/vue-file',
				name: 'vue-file',
				component: () => import('@/pages/views/vue/vue-file'),
				meta:{
					name: 'esvue-file6',
					requiresAuth: true
				}
			},

			// 服务器
			/*{
				path: '/markdown',
				name: 'markdown',
				component: () => import('@/pages/views/server/markdown'),
				meta:{
					name: 'markdown',
					requiresAuth: true
				}
			},*/
			{
				path: '/echarts',
				name: 'echarts',
				component: () => import('@/pages/views/server/echarts'),
				meta:{
					name: 'echarts'
				}
			},
			{
				path: '/api',
				name: 'api',
				component: () => import('@/pages/views/server/api'),
				meta:{
					name: 'api',
					requiresAuth: true
				}
			},
			{
				path: '/file',
				name: 'file',
				component: () => import('@/pages/views/server/file'),
				meta:{
					name: 'file',
					requiresAuth: true
				}
			},
			{
				path: '/log',
				name: 'log',
				// component: () => import('@/pages/views/server/log'),
				component: () => import('@/pages/views/home'),
				meta:{
					name: 'log',
					requiresAuth: true
				}
			},
			{
				path: '/log-login',
				name: 'log-login',
				component: () => import('@/pages/views/server/log-login'),
				meta:{
					name: 'log-login',
					requiresAuth: true
				},
			},
			{
				path: '/img',
				name: 'img',
				component: () => import('@/pages/views/server/img'),
				meta:{
					name: 'img',
					requiresAuth: true
				},
			},
			{
				path: '/recycle-bin',
				name: 'recycle-bin',
				component: () => import('@/pages/views/server/recycle-bin'),
				meta:{
					name: 'recycle-bin',
					requiresAuth: true
				},
			},
			{
				path: '/video',
				name: 'video',
				component: () => import('@/pages/views/server/video'),
				meta:{
					name: 'video',
					requiresAuth: true
				},
			}
		]
	},
	{
		path: '*',
		component: () => import('@/pages/common/404')
	}
];

const ROUTES = [
	{
		path: '/',
		redirect: to => {
			return {
				name: 'main',
			}
		}
	},
	{
		path: '/login',		
		name: 'login',
		component: () => import('@/pages/views/login'),	// 路劲渲染的页面组件，懒加载模式、异步组件
	},
	{
		path: '/main',																				
		component: () => import('@/pages/layout/main'), 			
		children: [ 																	// 嵌套子路由，相当于嵌入iframe
			{
				path: '/main',
				name: 'main',
				component: () => import('@/pages/views/home'),
				meta: {
					requiresAuth: true,	// 是否登录
					keepAlive: false,		// 是否缓存
				}
			},
			{
				path: '/table',
				name: 'table',
				component: () => import('@/pages/admin/table'),
				meta: {
					requiresAuth: true,	// 是否登录
					keepAlive: false,		// 是否缓存
				}
			},
		]
	}
];

export default ROUTES_OLD;
// export default ROUTES;